Release 10.1A: OpenEdge Deployment:
Managing 4GL Applications


Connection techniques

There are five ways to connect a database:

This section explains how to connect to databases using these various techniques. OpenEdge Development: Programming Interfaces explains why you might choose one technique instead of another.

Connecting at startup

You can connect to databases at session startup with one of the OpenEdge startup commands or with an application startup file. For example, the following PRO command starts a single-user session and connects to three databases:

pro -db mydb1 -db mydb2 -db mydb3 

Note: To retain compatibility with earlier versions, OpenEdge does not require you to specify the Database Name (-db) connection parameter for the first database on the command line.

If you specify more than one database when you start a session, it is important to specify the connection parameters for each database directly after the database name to which they apply, and before the next Database Name (-db) connection parameter. OpenEdge applies database connection parameters only to the previously specified database.

The following syntax example illustrates the correct location for database connection parameters:

mpro [ -db ] db1-name [ db1-parameters ] 
     [ -db db2-name [ db2-parameters ] ] ... 

You can specify all other parameters anywhere on the command line. If you specify the same parameter more than once, OpenEdge uses the value you specified for the last instance of the parameter.

You can also use a parameter file to specify database connection parameters. The following example shows a UNIX startup script for a client application. The last line invokes the _progres executable:

DLC=${DLC-/usr/dlc}; export DLC
PATH=:$PATH:$DLC; export PATH
PROPATH=:$DLC; export PROPATH
exec $DLC/_progres -pf parm1.pf -pf parm2.pf -p $APPL/start.p 

The previous startup script sets up environment variables for an application and starts a Progress 4GL client application session using two parameter files called parm1.pf and parm2.pf. The parm1.pf parameter file contains the following entry:

-db appldb1 -1 bi-file1 

The parm2.pf parameter file contains the following entry:

-db appldb2 -1 bi-file2 

This example illustrates a common approach to connecting multiple databases when you start OpenEdge using a parameter file for each database. Each parameter file is specified on the command line with the Parameter File (-pf) startup parameter.

Connecting from a procedure with the CONNECT statement

The CONNECT statement allows you to connect to a database from a 4GL procedure or from the Progress Procedure Editor.

The following CONNECT statements connect the appldb1 database in single-user mode, the appldb2 database in multi-user mode, and the databases specified in the parameter file, parm3.pf (respectively):

CONNECT appldb1 -1.
CONNECT appldb2.
CONNECT -pf parm3.pf. 

Connecting with the CONNECT statement is very similar to connecting at startup. Although it is possible to connect to several databases within one CONNECT statement, it is a good idea to connect only one database per CONNECT statement. A connection failure for one database causes a termination of the current CONNECT statement, leaving any subsequent database specified with the CONNECT statement unconnected. For detailed information about the CONNECT statement, see OpenEdge Development: Progress 4GL Reference and OpenEdge Development: Programming Interfaces .

Connecting with the Data Dictionary

You can connect to a database during a Progress 4GL session using the graphical user interface of the Data Dictionary.

To connect to a database with the Data Dictionary:

  1. Open the Data Dictionary. The Data Dictionary main window appears:
  2. Choose Database Connect. The Connect Database dialog box appears:
  3. Choose the Options button. The Connect Database dialog box expands to show optional connection controls:
  4. Enter the following information, then choose OK:
    • Physical Name — Specifies the actual name of the database on a disk.
    • Logical Name — Specifies the database name that references a connected physical database.
    • Database Type — Specifies the database type. The only possible value is PROGRESS.
    • Network — Specifies the network type, if you are connecting to a network server. The only possible value is TCP.
    • Multiple Users — Specifies whether you want multiple users to be able to access this database simultaneously.
    • Host Name — Specifies the database server machine in a network environment.
    • Service Name — Specifies the broker or server service name in a network environment.
    • User ID — Identifies your user ID.
    • Password — Identifies your password.
    • Trigger Location — Identifies a directory or Progress 4GL procedure library where trigger code is stored.
    • Parameter File — Specifies the parameter filename that contains the startup parameters for the database.
    • Other CONNECT Statement Parameters — Specifies any other startup parameters for the database that are not included in the parameter file.
    • OpenEdge returns you to the Data Dictionary main window. The Data Dictionary constructs (and executes) a CONNECT statement using the information you supply. Therefore, any rules that apply to the CONNECT statement also apply to database connections using the Data Dictionary.

Connecting with the Data Administration tool

You can also connect to a database during a Progress 4GL session using the Data Administration tool.

To connect to a database with the Data Administration tool:

  1. Open the Data Administration tool. The Data Administration main window appears:
  2. Choose Database Connect. The Connect Database dialog box appears:
  3. Choose the Options button. The Connect Database dialog box expands to show optional connection controls:
  4. Enter the following information, then choose OK:
    • Physical Name — Specifies the actual name of the database on a disk.
    • Logical Name — Specifies the database name that references a connected physical database.
    • Database Type — Specifies the database type. The only possible value is PROGRESS.
    • Network — Specifies the network type, if you are connecting to a network server. The only possible value is TCP.
    • Multiple Users — Specifies whether you want multiple users to be able to access this database simultaneously.
    • Host Name — Specifies the database server machine in a network environment.
    • Service Name — Specifies the broker or server service name in a network environment.
    • User ID — Identifies your user ID.
    • Password — Identifies your password.
    • Trigger Location — Identifies a directory or 4GL procedure library where trigger code is stored.
    • Parameter File — Specifies the parameter filename that contains the startup parameters for the database.
    • Other CONNECT Statement Parameters — Specifies any other startup parameters for the database that are not included in the parameter file.
    • OpenEdge returns you to the Data Administration main window. The Data Administration tool constructs (and executes) a CONNECT statement using the information you supply. Therefore, any rules that apply to the CONNECT statement also apply to database connections using the Data Administration tool.

Connecting with auto-connect

The OpenEdge auto-connect feature allows you to connect to databases automatically as required during program execution. To perform an auto-connect operation, OpenEdge uses information stored in a primary database to connect to a secondary application database, before running compiled procedures that access the second database. The primary database (the one that contains the auto-connect information for one or more additional databases) must be connected before OpenEdge can perform an auto-connect.

Use the Data Administration tool to build an auto-connect list for a primary database.

To create or edit an auto-connect list:

  1. Access the Data Administration tool.
  2. Choose Utilities Edit Progress Auto-Connect List. The Edit Auto-Connect List dialog box appears:
  3. Enter or edit connection information for a database.

If you connect to a database with the CONNECT statement, and that database also has an auto-connect entry in an already connected database, the connection information from both the CONNECT statement and the auto-connect list is merged. In this situation, the connection information in the CONNECT statement takes precedence. For more information about the CONNECT statement, see OpenEdge Development: Progress 4GL Reference .

If the primary database is a schema holder for a DataServer schema, the DataServer schema is automatically included in the auto-connect list, but it does not appear on the auto-connect list as viewed from the Data Dictionary.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095